package com.zlp.mapper;

import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.impl.DefaultMapperFactory;
import org.springframework.context.annotation.Configuration;

import java.util.List;
//@Configuration
public class MapperUtils {
	static MapperFactory mapperFactory;
	static {
		// 构建一个默认工厂
		mapperFactory = new DefaultMapperFactory.Builder().build();
	}

	public static <S, D> List<D> mapAsList(Iterable<S> source, Class<D> destinationClass) {
		return mapperFactory.getMapperFacade().mapAsList(source,destinationClass);
	}
}
